package project25;

import java.util.ArrayList;
import java.util.List;
import java.util.Scanner;

public class Main {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        List list = new ArrayList();
        int n=sc.nextInt();
        for(int i=0;i<n;++i)
        {
            list.add(new Person(sc.next(),sc.nextInt()));
        }
        for(int i=0;i<n;++i)
        {
            System.out.println(list.get(i).toString());
        }
        String name=sc.next();
        boolean flag=true;
        for(int i=0;i<n;++i)
        {
            if(((Person)list.get(i)).getName().equals(name))
            {
                flag=false;
                System.out.println(list.get(i).toString());
            }
        }
        if(flag)
        {
            System.out.println("此人不存在");
        }
    }
}
class Person
{
    private String name;
    private int age;

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    public Person() {
    }

    public Person(String name, int age) {
        this.name = name;
        this.age = age;
    }

    @Override
    public String toString() {
        return "Person [name="+this.getName()+", age="+this.getAge()+"]";
    }
}
